Added some general function calls for client login/logout at characters.#75
Added some general function calls for client login/logout at characters.#75tanith87 wants to merge 5 commits intoSphereserver:masterfrom
Conversation
…racter definition and its events.
|
that's ok for me, although this code add new f_onchar_login / f_onchar_logout functions without remove the previous one, so these functions will be triggered twice and this could a problem but probably this could be a problem to some ppl that don't like core changes that modify "old behaviors" and will not like to see f_onchar_[login/logout] getting changed. So I will leave this pull request open, if more devs approve it feel free to merge it on source PS: you can also simulate an f_onserver_[login/logout] using packet filter, just add "PACKETx=f_custom_login_function" on sphere.ini (the packet number must be decimal 0 ~ 255). Inside the function called by packet filter you can also get a ref to both client / char (I can't remember if the client is the REF1, SRC, ARGO, LOCAL.CLIENT, LOCAL.CHAR, whatever). You can check the packet number here: http://docs.polserver.com/packets/ |
|
Hello, Thanks for your feedback! :-) I don't get the point why they should get triggered twice? There are two different points to write your code. One at character triggers level and with this pull request one at a server client function level. These are two different things for different purposes, which trigger at the same time. Regarding your idea to use a packet filter. At first I thought, umh why didn't I thought about this? ;-) This should work for logins of course! But not for logging off when the client connection timed out. There will be no package to filter. ;-) The additional function of the pull request should handle this. |
lintax
left a comment
There was a problem hiding this comment.
Coruja is right, double-calling can happen. If the shard already has a function named f_onchar_login your new trigger would cause incompatibility problems.
But I really doubt if this is a common issue and since admins anyhow should always check the changelog before updating the server, so I think that request could be safely merged.
|
Merged again. :-) |
f_onchar_login/f_onchar_logout functions (usually placed in sphere_serv_triggers.scp) are now called for clients login/-out at characters. SRC is the character. This is independent from character definition or events to be more reliable.
The reason for this function calls is that there are sometimes cases where a functionality is really scoped to a client. Okay you could use events. But especially our tech staff sometimes makes experiments, and in these cases there are sometimes no events and stuff like that. But a reliable trigger is requred. So here it is.